import { getResidentialAreaList } from "@/api/residentialArea";

const state = {
  // 小区列表
  residentialAreaList: {},
};

const mutations = {
  // 存储小区列表
  setResidentialAreaData(state, payload) {
    state.residentialAreaList = payload;
    console.log(state.residentialAreaList);
  },
};

const actions = {
  // 获取小区列表数据
  async getResidentialAreaList(context, payload) {
    const data = await getResidentialAreaList(payload);
    if (data.code === 0) {
      context.commit("setResidentialAreaData", data.data);
    }
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
